<%-- 
    Document   : editProduct
    Created on : Dec 15, 2009, 8:11:48 PM
    Author     : Administrator
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib  prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title><c:if test="${product.autoId == 0}">
                "Create new product"
            </c:if>
                <c:if test="${product.autoId != 0}">
                Edit ${product.name}
            </c:if></title>
        <style type="text/css">
            .selected {
                background: yellow;
            }
        </style>
        <script type="text/javascript">
            function $(id){
                return document.getElementById(id);
            }
            function changeCat(id){
                $('catid').value = id;
                $('mainform').submit();
            }
        </script>
    </head>
    <body>
        <form method="post" id="mainform">
            <input type="hidden" name="catid" id="catid" value="${product.category.autoId}"/>
            <table border="1">
                <tr>
                    <td>Product name</td>
                    <td><input type="text" name="name" value="${product.name}" /></td>
                </tr>
                <tr>
                    <td>Product code</td>

                    <td><input type="text" name="code" value="${product.code}" /></td>
                </tr>
                <tr>
                    <td>Producer</td>
                    <td><input type="text" name="producer" value="${product.producer}" /></td>
                </tr>
                <tr>
                    <td>Description</td>

                    <td><input type="text" name="description" value="${product.description}" /></td>
                </tr>
                <tr>
                    <td>Unit</td>
                    <td><input type="text" name="unit" value="${product.unit}" /></td>
                </tr>
                <tr>
                    <td>Current Selling Price</td>
                    <td><input type="text" name="currentSellingPrice" value="${product.currentSellingPrice}" /> VND</td>
                </tr>
                <tr>
                    <th colspan="2">In category</th>

                </tr>
                <tr>
                    <td colspan="3">
                        ${product.category.getCategoryTreeHTML$1["javascript:changeCat(%d)"]}
                    </td>
                </tr>
                <tr>
                    <td colspan="2"><input type="submit" name="save" value="<c:if test="${product.autoId == 0}">Create</c:if><c:if test="${product.autoId != 0}">Update</c:if>"/></td>

                </tr>
            </table>
        </form>
    </body>

</html>
